package com.zh.factorymode.demo.resultfactory;

import java.time.LocalDate;

public class StringResultFactory extends DefaultResultFactory<String>{

    public String CreateFromDate(int y, int m, int d) {
        if (y == 0 && m == 0 && d == 0) {
            throw new UnsupportedOperationException("ResultSet.InvalidZeroDate");
        }else{
            return LocalDate.of(y, m, d).toString();
        }
    }


    public String CreateFromInt(Integer i) {
        if (i == null){
            return "";
        }else{
            return i.toString();
        }
    }
}
